﻿#Region "Imports"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Imports GenDotNet.TemplateData
Imports GenDotNet.TemplateSupport
Imports GenDotNet.TemplateSupport.Strings
#If CSharp Then
Imports GenDotNet.TemplateSupport.CSharp
#Else
Imports GenDotNet.TemplateSupport.VB
#End If
Imports GenDotNet.Task.Common
Imports <xmlns="http://kadgen.com/tempCode">
Imports <xmlns:orm="http://kadgen.com/KADORM.xsd">
#End Region

Public Class EditableRootDesigner
    Inherits DotNetLanguageBase

#Region "Required methods with static contents"
    Public Sub New()
		MyBase.New()
	End Sub

	' NEWTEMPLATE: Change to new guid for every new template
	Private ReadOnly _templateGuid As New Guid("{2A4E3E4C-C097-438d-A226-3CD2F82F44D3}")
	Public Overrides ReadOnly Property Id() As System.Guid
		Get
			Return _templateGuid
		End Get
	End Property

	Protected Overrides Function GetFileImports() As TemplateSupport.ImportInfoCollection
		Return New CslaTemplate.Support.CslaImportInfoCollection
	End Function

    Protected Overrides Function GenerateFile() As String
        ' NEWTEMPLATE: Exactly this code
		Return _
  <code>
	  <%= Me.OutputFile() %>
  </code>.Value.CleanOutput
    End Function

    Protected Overrides Function GetFileName(ByVal element As System.Xml.Linq.XElement) As String
        ' NEWTEMPLATE: Update the following file name
        Return OutputFileName(element.@Name.DesignerName)
    End Function
#End Region

    Protected Overrides Function GenerateContents() As String
        Dim classInfo = New TypeInfo(ObjectData.ClassName, _
                                     Scope.Public, _
                                     TypeCategory.Class, _
                                     TypeModifiers.Partial)

		classInfo.InheritsFrom = New TypeInfo()
      classInfo.Attributes.AddSerializable()

        Return Me.OutputClass(classInfo, _
                              Function() OutputConstructor(Scope.Private, _
                                                AddressOf MemberConstructor))
    End Function

    Private Function MemberConstructor() As String
        Return _
        <code>
         ' Require use of factory method
      </code>.Value
    End Function

End Class
